package com.jzo2o.market.controller.consumer;

import com.jzo2o.market.model.dto.response.CouponInfoResDTO;
import com.jzo2o.market.service.ICouponService;
import com.jzo2o.mvc.utils.UserContext;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * description
 *
 * @author yuanguangbin
 * @date 2024/6/18 19:18
 */
@RestController("consumerCouponController")
@RequestMapping("/consumer/coupon")
@Api(tags = "用户端 - 优惠卷相关接口")
public class CouponController {

    @Resource
    private ICouponService couponService;

    @GetMapping("/my")
    @ApiOperation("/我的优惠卷列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "lastId",value = "上一次查询最后一张优惠卷id",required = false,dataTypeClass = Long.class),
            @ApiImplicitParam(name = "status",value = "优惠卷状态:1.未使用,2:已使用,3.已过期",required = true,dataTypeClass = Long.class)
    })
    public List<CouponInfoResDTO> queryMyCouponForPage(@RequestParam(value = "lastId",required = false) Long lastId,
                                                       @RequestParam(value = "status",required = true) Integer status){
        return couponService.queryForList(lastId, UserContext.currentUserId(),status);
    }




}
